/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pacoteframe;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Elaine
 */
@Entity
@Table(name = "tb_cargo", catalog = "db_plastek", schema = "")
@NamedQueries({
    @NamedQuery(name = "TbCargo.findAll", query = "SELECT t FROM TbCargo t"),
    @NamedQuery(name = "TbCargo.findByIdCargo", query = "SELECT t FROM TbCargo t WHERE t.idCargo = :idCargo"),
    @NamedQuery(name = "TbCargo.findByNomeCargo", query = "SELECT t FROM TbCargo t WHERE t.nomeCargo = :nomeCargo")})
public class TbCargo implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_cargo")
    private Integer idCargo;
    @Column(name = "nome_cargo")
    private String nomeCargo;

    public TbCargo() {
    }

    public TbCargo(Integer idCargo) {
        this.idCargo = idCargo;
    }

    public Integer getIdCargo() {
        return idCargo;
    }

    public void setIdCargo(Integer idCargo) {
        Integer oldIdCargo = this.idCargo;
        this.idCargo = idCargo;
        changeSupport.firePropertyChange("idCargo", oldIdCargo, idCargo);
    }

    public String getNomeCargo() {
        return nomeCargo;
    }

    public void setNomeCargo(String nomeCargo) {
        String oldNomeCargo = this.nomeCargo;
        this.nomeCargo = nomeCargo;
        changeSupport.firePropertyChange("nomeCargo", oldNomeCargo, nomeCargo);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCargo != null ? idCargo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TbCargo)) {
            return false;
        }
        TbCargo other = (TbCargo) object;
        if ((this.idCargo == null && other.idCargo != null) || (this.idCargo != null && !this.idCargo.equals(other.idCargo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pacoteframe.TbCargo[ idCargo=" + idCargo + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
